package com.example.model;

import lombok.Data;

/**
 * Created with IntelliJ IDEA.
 * Description:用来实现翻页功能
 * User: bjc
 * Date: 2025-07-23
 * Time: 22:17
 */
@Data
public class PageRequest {
    private Integer currentPage = 1; //当前页码，默认从1开始
    private Integer pageSize = 10; //每页展示条数，默认每页显示10条记录
    private  Integer offset;//数据库查询的起始索引


    /**
     * 获取数据库查询的起始索引
     * @return
     */
    public Integer getOffset() {
        return (currentPage-1) * pageSize;
    }
}
